<%@ page import="java.sql.*,studentportal.*"%>
<html>

<head>
 
<title>New Page 1</title>
</head>

<body background="indtextb.jpg" bgcolor="#FFFFFF" text="#000000" link="#3366CC" vlink="#666666" alink="#996600">

<table border="0" width="100%" bordercolorlight="#666666" bordercolordark="#000000">
  <tr>
    <td width="100%"><img border="0" src="StdPrtlbanner.jpg" width="846" height="65">&nbsp;</td>
  </tr>
</table>
<table border="0" width="100%">
  <tr>
     <td width="20%">
      <p align="center"><font face="Trebuchet MS, Arial, Helvetica">
      <a href="FacultyPersonalInfoView.jsp"><b>Personal Info</b></a></font></td>

     <td width="20%">
      <p align="center"><font face="Trebuchet MS, Arial, Helvetica">
      <a href="FacultyListCourses.jsp"><b>View Courses</b></a></font></td>
   
    <td width="20%">
      <p align="center"><a href="Home.html"><b>Home</b></a></td>
  </tr>
</table><br/><br/>
<form method="get" action="./FacultyMarkStore.jsp">
<table border="1" align="center">
	<tr>
			<th>Student ID</th>
			<th>Student Name</th>
			<th>Student Email</th>
			<th>Date</th>
			<th>File Download</th>
			<th>Status</th>
			<th>Download</th>
	</tr>
<%
try
{
			String fid=(String)session.getAttribute("FacultyID");
			String qry="SELECT student_master.* from student_master where course_id in (select course_id FROM faculty_assignment_master,faculty_assign_master where faculty_assignment_master.assign_id=faculty_assign_master.assign_id and faculty_assignment_master.assign_id="+fid+")";
			qry="SELECT student_master.* from student_master where course_id in (select course_id FROM faculty_assignment_master,faculty_assign_master where faculty_assignment_master.assign_id=faculty_assign_master.assign_id and faculty_assign_master.faculty_id="+fid+")";

			String qry1="select student_assignment_master.* from student_assignment_master where student_id=? and assignment_id="+request.getParameter("IID")+" and assign_id="+request.getParameter("ID");
		/*	qry1="select student_assignment_master.* from student_assignment_master where  assignment_id="+request.getParameter("IID")+" and assign_id="+request.getParameter("ID");*/
			System.out.println("====="+qry);
			Connection con=MySQLDriver.getConnection();
			
			Statement st=con.createStatement();
			
			PreparedStatement stt=con.prepareStatement(qry1);
			
			ResultSet rs=st.executeQuery(qry);
			ResultSet rss=null;
			while(rs.next()){
			System.out.println("sfdasafdsaf safsa fsa="+rs.getString(1));
			  stt.setString(1,rs.getString(1));
			  rss=stt.executeQuery();
			  if(rss!=null && rss.next()) {
			  do {
%>
				<tr>
					<td><%=rs.getString(1) %></td>
					<td><%=rs.getString(2) %></td>
					<td><%=rs.getString(6) %></td>
					<td><%=rss.getString(5) %></td>
					<td><%=rss.getString(6) %></td>
					<td>Submited</td>
					<td><a href='FileDownload.jsp?fileName=<%=rss.getString(6)%>&file=<%=rss.getString(6)%>'/>Download</a></td>
				</tr>
<%
           }while(rss.next());
            }
           else {

%>
				<tr>
					<td><%=rs.getString(1) %></td>
					<td><%=rs.getString(2) %></td>
					<td><%=rs.getString(6) %></td>
					<td>&nbsp;</td>
					<td>&nbsp;</td>
					<td>Not Submited</td>
					<td>&nbsp;</td>
				</tr>

<%
            }
			rss.close();
			}

}
catch(Exception e)
{
	%>
		<tr>
				<td>	<%="No Students"%></td>
		</tr>
<%

}

%>
	</table>
</form>
</body>

</html>
